package com.wiki.gds.rabbitmq.send;

import com.wiki.gds.rabbitmq.controller.MOMO;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.batch.BatchProperties;
import org.springframework.stereotype.Component;

@Component
public class MessageSender{
    @Autowired
    private RabbitTemplate rabbitTemplate;
    //发送一个字符串
    public void send(String msg) {
        this.rabbitTemplate.convertAndSend("exchangeName","routingKey", msg);
    }
    //发送一个可序列化对象
    public void send(Object t) {
        this.rabbitTemplate.convertAndSend("exchangeName","routingKey", t);
    }
}